<?php
/**
 * Created by PhpStorm.
 * User: holy
 * Date: 2018/4/20
 * Time: 上午7:12
 */

namespace Admin\Model;

use Think\Model\RelationModel;

class CategoryModel extends RelationModel
{
    //每个一级分类有很多二级分类
    protected $_link = array(
        'children' => array(
            'mapping_type' => self::HAS_MANY,
            'class_name' => 'Category',
            'foreign_key' => 'parent_id',
            'mapping_order' => 'sort_order asc'
        ),
    );
}